// 全局类型定义
export interface User {
  id: string;
  username: string;
  avatar?: string;
  email: string;
  role: "student" | "teacher" | "admin";
}

export interface Post {
  id: string;
  title: string;
  content: string;
  images?: string[]; // 帖子图片
  author: User;
  category: "discussion" | "help" | "share" | "trade";
  tags: string[];
  createdAt: string;
  updatedAt: string;
  likes: number;
  comments: number;
  views: number;
  // 求助帖子专用字段
  helpStatus?: "pending" | "in_progress" | "resolved"; // 求助状态
  helpType?: string; // 求助类型
  contact?: string; // 联系方式
  requirements?: string; // 要求/期望
  reward?: string; // 奖励/酬劳
  // 分享帖子专用字段
  shareType?: string; // 分享类型：学习资料、好东西、风景等
  resourceLinks?: string[]; // 资源链接
  downloadUrl?: string; // 下载地址
  // 交易帖子专用字段（用于创建）
  price?: number; // 价格
  tradeStatus?: "available" | "sold" | "reserved"; // 交易状态
  tradeCategory?: string; // 交易分类
}

// 统一的帖子创建参数
export interface CreatePostParams {
  title: string; // 标题 - 必填
  content: string; // 内容 - 必填
  category: "discussion" | "help" | "share" | "trade"; // 分类 - 必填
  tags: string[]; // 标签 - 必填
  images?: string[]; // 图片
  // 求助专用
  helpType?: string; // 求助类型
  contact?: string; // 联系方式
  requirements?: string; // 要求/期望
  reward?: string; // 奖励/酬劳
  // 分享专用
  shareType?: string; // 分享类型
  resourceLinks?: string[]; // 资源链接
  downloadUrl?: string; // 下载地址
  // 交易专用
  price?: number; // 价格
  tradeCategory?: string; // 交易分类
}

export interface Activity {
  id: string;
  title: string;
  description: string;
  organizer: User;
  startTime: string;
  endTime: string;
  location: string;
  maxParticipants: number;
  currentParticipants: number;
  status: "upcoming" | "ongoing" | "ended";
  createdAt: string;
}

export interface Knowledge {
  id: string;
  title: string;
  content: string;
  author: User;
  category: string;
  tags: string[];
  createdAt: string;
  updatedAt: string;
  views: number;
  likes: number;
}

export interface Product {
  id: string;
  title: string;
  description: string;
  price: number;
  images: string[];
  seller: User;
  category: string;
  status: "available" | "sold" | "reserved";
  tags?: string[];
  createdAt: string;
  updatedAt: string;
}

// 用户在线状态
export type UserStatus = "online" | "hidden" | "offline";

// 消息类型
export type MessageType = "official" | "system" | "normal" | "other";

// 消息通知
export interface Notification {
  id: string;
  type: MessageType;
  title: string;
  content: string;
  sender?: User;
  isRead: boolean;
  createdAt: string;
}

// 位置信息
export interface LocationInfo {
  city: string;
  province?: string;
  country?: string;
}

// 评论
export interface Comment {
  id: string;
  postId: string;
  content: string;
  author: User;
  createdAt: string;
  likes: number;
  replies?: Comment[];
}
